// ==UserScript==
// @name			Minus 1h5h
// @namespace		http://ntorgov.blogspot.com/2012/02/youtube.html
// @description		Удаление всяких мудней из рекомендованных
// @include			http://www.youtube.com/*
// @include			https://www.youtube.com/*
// @version			1.8
// @versionnumber	1.8
// @date			2012-02-08
// @author			Bagdad
// @icon			http://lh6.googleusercontent.com/-WQ-Z5LbxULE/TzNqatV0TTI/AAAAAAAALjY/u1-xo7LIgfk/s800/m1h5h.png
// ==/UserScript==

var version = 1.8;

var SpisokMudakov = new Array('AdamThomasMoran', 'ThisIsHorosho', 'sportdiogen', 'PavelVolyaOfficial', 'comedoz');
var SpisokKontainerov = new Array('recommended-videos', 'watch-context-item-list', 'watch-related');

for(ContCount = 0; ContCount < SpisokKontainerov.length; ContCount ++) {
	var RecomendedArray = document.getElementById(SpisokKontainerov[ContCount]);
	if(RecomendedArray != null) {
		if(RecomendedArray.children.length) {
			for (var TestCounter = 0; TestCounter < RecomendedArray.children.length; TestCounter++) {
				if (RecomendedArray.children[TestCounter].tagName == "LI") {
					var RootElement = RecomendedArray.children[TestCounter];
					var SecondElement = RootElement.children[0];
					if(SecondElement!=undefined) {
						for(ChildrenSubCount=0; ChildrenSubCount<SecondElement.children.length; ChildrenSubCount++) {
						
							if(SecondElement.children[ChildrenSubCount]!=undefined) {
								if(SecondElement.children[ChildrenSubCount].tagName == 'SPAN') {
									if(SecondElement.children[ChildrenSubCount].children[0] != undefined){
										if(SecondElement.children[ChildrenSubCount].children[0].tagName == 'SPAN'){
											var YouTubeUser = SecondElement.children[ChildrenSubCount].children[0].innerHTML;
											for(var ListCheck = 0; ListCheck < SpisokMudakov.length; ListCheck++) {
												if(YouTubeUser.toLowerCase() ==  SpisokMudakov[ListCheck].toLowerCase()) {
													RemoveNodeAndHide(RootElement);
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

function RemoveNodeAndHide(RootElement) {
	while(RootElement.hasChildNodes()) {
		RootElement.removeChild(RootElement.lastChild);
	}
	RootElement.style.display='none';
}
